//
//  ViewController.m
//  AlarmClock
//
//  Created by apple on 16/9/28.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ViewController.h"
#import "BSKConsts.h"
#import "SDAutoLayout.h"
#import "BSKStopWatchViewController.h"
#import "BSKTimeKeepingViewController.h"
#import "AlarmClockViewController.h"
#import "BSKCancelAlarmClockViewController.h"
#import "BSKSington.h"
#import "UILocalNotification+setAlarmclock.h"
#import "BSKMainViewController.h"

@interface ViewController ()<UIScrollViewDelegate>
@property(nonatomic,strong)UIScrollView * scrollView;
@property (nonatomic,strong) UIView *roundView;
@property (nonatomic,strong) UIButton *alarmClockButton;
@property (nonatomic,strong) UIButton *timeButton;
@property (nonatomic,strong) UIButton *secondButton;
@property (nonatomic,assign) NSInteger curentPage;
@property (nonatomic,strong) UIImageView * bgImage;
@property (nonatomic,assign) BOOL showTimeKeepingAlertFlag;
@property (nonatomic,strong) BSKMainViewController * mainvc;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.mainvc=[[BSKMainViewController alloc]init];
    [self addChildViewController:self.mainvc];
    self.navigationBarHidden = YES;
    [BSKSington sharBSKSington].rootViewController = self;
}

-(void)viewDidAppear:(BOOL)animated{
    [self.mainvc viewDidAppear:animated];
    UILocalNotification *notification =[[BSKSington sharBSKSington] objectForKey:@"ReceiveLocalNotification"];
    if (notification) {
        if ([[notification.userInfo objectForKey:@"id"] isEqualToString:@"StopWatchNoti"]) {
            //        NSLog(@"收到倒计时通知！");
            [[NSNotificationCenter defaultCenter]postNotificationName:@"StopWatchAlertNotification" object:@{@"applicationState":@(UIApplicationStateBackground),@"notify":notification}];
        }else{
//            NSLog(@"收到通知！");
            [[NSNotificationCenter defaultCenter]postNotificationName:@"UILocalNotification" object:@{@"applicationState":@(UIApplicationStateBackground),@"notify":notification}];
        }
        [[BSKSington sharBSKSington] removeObjectForKey:@"ReceiveLocalNotification"];
    }
}


-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

@end




